<template>
    <el-select :size="size" :value="value" @input="$emit('input', $event)" :placeholder="placeholder" clearable>
        <el-option  :label="data[labelFiled]" v-for="data in dataList" :key="data[keyFiled]" :value ="data[keyFiled]">{{ data[labelFiled] }}</el-option>
    </el-select>
</template>
<script>
import { getDictDataList } from '@/utils'
export default {
  name: 'FSelect',
  data () {
    return {
      dataList: []

    }
  },
  mounted() {
  	   this.getDataByUrl()
  },
  props: {
    value: [Number, String],
    placeholder: String,
	size: String,
	
	keyFiled: String,
	labelFiled: String,
	fUrl: String,
	fParams: {}
  },
  methods:{
	 getDataByUrl(){
		 return this.$http.get(this.fUrl ,this.fParams).then(({ data: res }) => {
		   if (res.code !== 200) {
		     return this.$message.error(res.msg)
		   }
		   this.dataList = res.rows
		 }).catch(() => {})
	 }
  }
}
</script>
